sum
Type
function
Summary
Returns the sum of a list of numbers.
Syntax
sum(<numbersList>)
Description
Use the sum function to add a group of values together.
The sum function is equivalent to the following statements:
repeat with x = 1 to the number of items of numbersList
add item x of numbersList to sumValue
end repeat
return sumValue
If the numbersList is empty, the sum function returns zero.
If a math operation on finite inputs produces a non-finite output, an execution error is thrown. See math operations for more information.
Parameters
Name | Type | Description |
---|---|---|
numbersList | numbers |
|
Examples
put sum(1,5,2,3) -- returns 11
Related
glossary: statement, return, value, math operation
operator: plus
control structure: function
function: standardDeviation, min, max, extents
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile